Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose User/Org information under site.github.owner #151

Merged
merged 2 commits into from
Jan 16, 2019

Conversation

filbranden
Copy link
Contributor

Fixes #149.

Tested locally for a User object, captured everything I was interested in (full name, email, company, bio, ...)

/cc @parkr @benbalter

Thanks!
Filipe

@filbranden
Copy link
Contributor Author

Update: Fixed the test case, so now CI tests pass.

I also managed to test this on a project page (by setting env variable PAGES_REPO_NWO) and confirmed the organization object looks OK.

I investigated filtering fields such as email (using c.user(owner, "type" => "public"), similar to c.list_repos() below), but that does not work... If you really think that information should be filtered out, can you suggest a way to do that?

Thanks!
Filipe

@filbranden filbranden changed the title Expose User/Org information under site.github.owner Expose User/Organization information under site.github.owner Jan 4, 2019
@filbranden filbranden changed the title Expose User/Organization information under site.github.owner Expose User/Org information under site.github.owner Jan 4, 2019
@parkr
Copy link
Member

parkr commented Jan 7, 2019

I think we'd feel safer with an allow list. This would also allow us to upgrade to GraphQL in the future. Here's what I think we should allow:

{
  "login": "octocat",
  "id": 1,
  "node_id": "MDQ6VXNlcjE=",
  "avatar_url": "https://github.com/images/error/octocat_happy.gif",
  "html_url": "https://github.com/octocat",
  "type": "User",
  "site_admin": false,
  "name": "monalisa octocat",
  "company": "GitHub",
  "blog": "https://github.com/blog",
  "location": "San Francisco",
  "bio": "There once was...",
  "public_repos": 2,
  "public_gists": 1,
  "followers": 20,
  "following": 0,
  "created_at": "2008-01-14T04:33:35Z",
  "updated_at": "2008-01-14T04:33:35Z"
}

For organizations, let's allow only the following fields:

{
  "login": "github",
  "id": 1,
  "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
  "url": "https://api.github.com/orgs/github",
  "avatar_url": "https://github.com/images/error/octocat_happy.gif",
  "description": "A great organization",
  "name": "github",
  "company": "GitHub",
  "blog": "https://github.com/blog",
  "location": "San Francisco",
  "email": "[email protected]",
  "is_verified": true,
  "has_organization_projects": true,
  "has_repository_projects": true,
  "public_repos": 2,
  "public_gists": 1,
  "followers": 20,
  "following": 0,
  "html_url": "https://github.com/octocat",
  "created_at": "2008-01-14T04:33:35Z",
  "type": "Organization",
  "collaborators": 8,
}

What do you think?

@filbranden
Copy link
Contributor Author

Sure @parkr that list looks pretty reasonable. I can work on an update and push to this PR. Thanks!

@filbranden filbranden force-pushed the userinfo1 branch 2 times, most recently from a23475c to d2e5a35 Compare January 8, 2019 01:46
@filbranden
Copy link
Contributor Author

Done. Please take a look.

The AppVeyor failures look unrelated... Can you please relaunch those two failing jobs?

@ashmaroli
Copy link
Member

Can you please relaunch those two failing jobs?

@filbranden Done!

:updated_at,
])

def owner_obj
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of owner_obj, how about calling this owner_metadata? A comment above the method would also help tremendously! I'm also tempted to move this user lookup & filter into a separate Drop class...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

(When first writing the code, I was thinking of a follow up that would rename owner to owner_name to make those match... It's a much more intrusive patch, but maybe it would be nice to have the same name on either side?)

In any case, renamed as requested. Please take another look.

@filbranden
Copy link
Contributor Author

AppVeyor is 1/4 unhappy... Please restart that build if possible? Thanks!

@parkr
Copy link
Member

parkr commented Jan 16, 2019

Thank you so much!

@jekyllbot: merge +minor

@jekyllbot jekyllbot merged commit f05be64 into jekyll:master Jan 16, 2019
jekyllbot added a commit that referenced this pull request Jan 16, 2019
@filbranden filbranden deleted the userinfo1 branch January 16, 2019 05:22
@filbranden
Copy link
Contributor Author

Awesome, thanks a lot!

@jekyll jekyll locked and limited conversation to collaborators Jan 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please expose user information for User pages
5 participants